package com.zzyq.pc.common.enums;

import com.zzyq.pc.web.user.model.Role;

public enum RoleEnum {
    Admin_Super("admin_super", "超级管理员", 0), Admin_Sys("admin_sys", "系统管理员", 10), Admin_Com("admin_com", "团体管理员",
            50), User_Com("user_com", "团体主管",
                    100), User_Depart("user_depart", "部门主管", 150), User_Simple("user_simple", "普通用户", 200);
    private String role;
    private String name;
    private Integer grade;

    private RoleEnum(String role, String name, Integer grade) {
        this.role = role;
        this.name = name;
        this.grade = grade;
    }

    /**
     * 直接从枚举映射成Role角色对象
     */
    public Role transToRole() {
        Role role = new Role();
        role.setRoleName(getName());
        role.setRoleGrade(getGrade());
        role.setRoleEnum(getRole());
        return role;
    }

    public String getRole() {
        return role;
    }

    public void setRole(String role) {
        this.role = role;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public Integer getGrade() {
        return grade;
    }

    public void setGrade(Integer grade) {
        this.grade = grade;
    }

}
